﻿<%@ Page Title="Invoke web service - SOAP" ValidateRequest="false" EnableEventValidation="false" ViewStateEncryptionMode="Never" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Soap.aspx.cs" Inherits="LoadController._Soap" %>

<%@ Register Assembly="LoadController" Namespace="CustomControls" TagPrefix="cc" %>
<%--<%@ Register Assembly="WebRole" Namespace="ObjectWebEditor" TagPrefix="owe" %>--%>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">



    <div class="grid">
        <div class="row">
            <div class="span10">
                <%--            <div class="input-control text">
                <asp:TextBox  ID="textEndPointUri" runat="server" CssClass="with-helper">http://www.webservicex.net/ConvertWeight.asmx</asp:TextBox>
                <button class="helper" onclick="return false"></button>
            </div>--%>
                <%--            <div class="input-control text">
                <asp:TextBox ID="textEndPointUri" runat="server" CssClass="with-helper">http://andreascloudservice1.cloudapp.net/Service1.svc</asp:TextBox>
                <button class="helper" onclick="return false"></button>
            </div>--%>
                <%--C:\Users\ANDREAS\Desktop\422qeery.dll--%>
<%--                <div class="input-control text">
                    <asp:TextBox ID="textEndPointUri" runat="server" CssClass="with-helper">http://localhost/HostWCFService/Service.svc</asp:TextBox>
                    <button class="helper" onclick="return false"></button>
                </div>--%>
                <div class="input-control text">
                    <asp:TextBox ID="textEndPointUri" placeholder="Please enter link to SOAP service (*.asmx, *.asmx?WSDL, *.svc)"  runat="server" CssClass="with-helper"></asp:TextBox>
                    <button class="helper" onclick="return false"></button>
                </div>
                <%--<asp:TextBox class="span7" ID="textEndPointUri" runat="server" CssClass="with-helper">http://www.webservicex.net/ConvertWeight.asmx</asp:TextBox>--%>
            </div>
            <div class="span2">
                <asp:Button ID="buttonGet" runat="server" Text="Start" OnClick="buttonGet_Click" />
            </div>
        </div>

        <div class="row">
            <div class="span4">
                <cc:CustomTreeView ID="TreeViewService" runat="server" ImageSet="Arrows" CssClass="treeview"
                    RootNodeStyle-ImageUrl="~/CustomTreeView/globe.png" OnSelectedNodeChanged="ServiceTreeView_SelectedNodeChanged" OnSelectedNodeClicked="TreeViewService_SelectedNodeClicked">
                </cc:CustomTreeView>
            </div>

            <h2>
                <asp:Label ID="LabelMethodName" runat="server" /></h2>

            <div class="page-control span8" data-role="page-control" id="PagerControl" runat="server" style="display:none">
                <span class="menu-pull"></span>
                <div class="menu-pull-bar"></div>

                <ul>
                    <li id="PageControl_li_Page1"><a href="#PageControl_Page1"><i class="icon-equalizer"></i>Single invoke</a></li>
                    <li class="active" id="PageControl_li_Page2"><a href="#PageControl_Page2">Define random invokes</a></li>
                    <%--<li class="place-right"><a href="#page4"><i class="icon-cog nrm"></i></a></li>--%>
                </ul>

                <div class="frames">
                    <div class="frame" id="PageControl_Page1">

                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:PlaceHolder runat="server" ID="PlaceHolderControls"></asp:PlaceHolder>
                            </ContentTemplate>
                            <Triggers>
                            </Triggers>
                        </asp:UpdatePanel>

                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                            <ContentTemplate>
                            </ContentTemplate>
                        </asp:UpdatePanel>

                        

                        <asp:PlaceHolder ID="PlaceHolderInvokeButton" runat="server" Visible="False">
                            <br />
                            <hr>
                            <div class="row">
                                <div class="span2">
                                    <asp:Label ID="Label4" runat="server" Text="single invoke" CssClass="ControlLabelHeader"></asp:Label>
                                    <asp:Button ID="InvokeMethodSingle" runat="server" Text="Test single invoke" OnClick="InvokeMethodSingle_Click"/>
                                </div>

                                <div class="span2" style="display: none;">
                                    <asp:Label ID="Label5" runat="server" Text="job setup" CssClass="ControlLabelHeader"></asp:Label>
                                    <asp:Button ID="InvokeMethodSingleServer" Enabled="false" CssClass="bg-color-green" runat="server" Text="Continue job setup" PostBackUrl="~/JobSetup.aspx" OnClick="InvokeMethodSingleServer_Click"/>
                                </div>
                            </div>    
                            <br />
                        </asp:PlaceHolder>
                    </div>
                    <div class="frame active" id="PageControl_Page2">
                        <asp:PlaceHolder runat="server" ID="PlaceHolderControlsRandom"></asp:PlaceHolder>

                        <asp:PlaceHolder ID="PlaceHolderInvokeButtonRandom" runat="server" Visible="True">
                            <br />
                            <hr>
                            <div class="row">
                                <div class="span2">
                                    <asp:Label ID="Label2" runat="server" Text="random invoke" CssClass="ControlLabelHeader"></asp:Label>
                                    <asp:Button ID="InvokeMethodRandom" runat="server" Text="Test" OnClick="InvokeMethodRandom_Click" />
                                </div>
                                <div class="span2">
                                    <asp:Label ID="Label1" runat="server" Text="Loop count" CssClass="ControlLabelHeader"></asp:Label>
                                    <div class="input-control text">
                                        <asp:TextBox ID="InvokeCount" runat="server" CssClass="with-helper">10</asp:TextBox>
                                        <button class="helper" onclick="return false"></button>
                                    </div>
                                </div>
                                <div class="span2">
                                    <asp:Label ID="Label3" runat="server" Text="job setup" CssClass="ControlLabelHeader"></asp:Label>
                                    <asp:Button ID="InvokeMethodRandomServer" Enabled="false" CssClass="bg-color-green" runat="server" Text="Continue" PostBackUrl="~/JobSetup.aspx" OnClick="InvokeMethodRandomServer_Click" />
                                </div>
                            </div>
                            <br />
                        </asp:PlaceHolder>
                        
                        <table class="hovered">
                            <thead>
                                <tr>
                                    <th>Description</th>
                                    <th>Expression</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>ranges</td>
                                    <td><code>1-100</code></td>
                                </tr>
                                <tr>
                                    <td>ranges + values</td>
                                    <td><code>1-100;500-600;712;834;</code></td>
                                </tr>
                                <tr>
                                    <td>german zipcode</td>
                                    <td><code>re:((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))</code></td>
                                </tr>
                                <tr>
                                    <td>float</td>
                                    <td><code>re:^(0|(-?(((0|[1-9]\d*)\.\d+)|([1-9]\d*))))$</code></td>
                                </tr>
                                <tr>
                                    <td>rnd string</td>
                                    <td><code>re:^[a-zA-Z]+$</code></td>
                                </tr>
                                <tr>
                                    <td>strings</td>
                                    <td><code>abc;def;ghi;jkl;mno;pqr;stu;vwx;yz;</code></td>
                                </tr>
                            </tbody>
                            <tfoot></tfoot>
                        </table>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <asp:PlaceHolder ID="PlaceHolderMessages" runat="server" Visible="False">
        <div class="row">
            <div class="span12">
                <h2>Request - Response</h2>
                <table class="hovered">
                    <thead>
                        <tr>
                            <th></th>
                            <th>No.</th>
                            <th>Message</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:PlaceHolder ID="PlaceHolderMessagesTable" runat="server"></asp:PlaceHolder>
                    </tbody>
                    <tfoot></tfoot>
                </table>
            </div>
        </div>

    </asp:PlaceHolder>

    <asp:PlaceHolder ID="PlaceHolderValidationControlsSingleInvoke" runat="server"></asp:PlaceHolder>
    <asp:PlaceHolder ID="PlaceHolderValidationControlsRandomInvoke" runat="server"></asp:PlaceHolder>
                        
    <div class="row" id="ErrorMessageDialog" runat="server" style="display: none">
        <div class="span12" style="background-color: #b91d47;">
            <div class="error-bar fg-color-white">
                <input class="place-right" type="button" value="Close" onclick="Show_Hide_Display('<%=ErrorMessageDialog.ClientID%>')" />
                <asp:ValidationSummary ID="ValidationSummarySingleInvoke" ShowSummary="true" DisplayMode="List" runat="server" ValidationGroup="VGroupSingleInvoke" />
                <asp:ValidationSummary ID="ValidationSummaryRandomInvoke" ShowSummary="true" DisplayMode="List" runat="server" ValidationGroup="VGroupRandomInvoke" />
                <br /><br />
                <asp:Label ID="LabelErrorMessageDialog" runat="server" ViewStateMode="Disabled" EnableViewState="False" />
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function Show_Hide_Display(id) {
            var div1 = document.getElementById(id);
            if (div1.style.display == "" || div1.style.display == "block") {
                div1.style.display = "none";
            }
            //else {
            //    div1.style.display = "block";
            //}
            return false;
        }

        function ClearContent(id) {
            var ctrl = document.getElementById(id);
            ctrl.value = "";
        }


        function Validate() {
            if (typeof (Page_ClientValidate) == 'function') {
                Page_ClientValidate();
            }
            ChangeBackColor();

            if (typeof (Page_IsValid) !== 'undefined')
            {
                if (!Page_IsValid) {
                    document.getElementById('<%=ErrorMessageDialog.ClientID%>').style.display = "block";
                    return false;
                }
            }
            else {
                return false;
            }
            Show_Hide_Display('<%=ErrorMessageDialog.ClientID%>')
            return true;
        }


        function ChangeBackColor() {
            if (typeof (Page_Validators) !== 'undefined')
            {
                for (var i = 0; i < Page_Validators.length; i++) {
                    var val = Page_Validators[i];
                    var ctrl = document.getElementById(val.controltovalidate);
                    if (ctrl != null && ctrl.style != null) {
                        if (!CheckIfValid(ctrl)) {
                            ctrl.style.background = 'lightcoral';
                            ctrl.style.borderColor = 'red';
                        }
                        else {
                            ctrl.style.background = '';
                            ctrl.style.borderColor = '';
                        }
                        ValidatorUpdateIsValid();
                        ValidationSummaryOnSubmit(val.validationGroup);
                    }


                    function CheckIfValid(control) {
                        for (var i = 0; i < control.Validators.length; i++) {
                            if (!control.Validators[i].isvalid) {
                                return false;
                            }
                        }
                        return true;
                    }
                }
            }
            else {
                return false;
            }
        }
       


        $(document).ready(function () {
            Validate();
            DefineActivePage("<%=ActivePage%>");
        });

        function DefineActivePage(page) {
            if (page == "Page1") {
                var li1 = document.getElementById("PageControl_li_Page1");
                li1.setAttribute('class', 'active');

                var li2 = document.getElementById("PageControl_li_Page2");
                li2.removeAttribute('class');
                
                var divPage1 = document.getElementById("PageControl_Page1");
                divPage1.setAttribute('class', 'frame active');

                var divPage2 = document.getElementById("PageControl_Page2");
                divPage2.setAttribute('class', 'frame');
            }
            else if (page == "Page2") {
                var li2 = document.getElementById("PageControl_li_Page2");
                li2.setAttribute('class', 'active');

                var li1 = document.getElementById("PageControl_li_Page1");
                li1.removeAttribute('class');

                var divPage2 = document.getElementById("PageControl_Page2");
                divPage2.setAttribute('class', 'frame active');

                var divPage1 = document.getElementById("PageControl_Page1");
                divPage1.setAttribute('class', 'frame');
            }
            
        }
    </script>

</asp:Content>

